package com.reggie;

import org.junit.jupiter.api.Test;

import java.util.ArrayList;

public class A11 {
    @Test
    public void a11_1() {
        ArrayList<String> list = new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");

        System.out.print("[");
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + " ");
        }
        System.out.print("]");
    }
    @Test
    public void a11_2(){
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        System.out.println(list);
    }
    @Test
    public void a11_3(){
        ArrayList<Character> list = new ArrayList<>();
        list.add('1');
        list.add('a');
        list.add('c');
        System.out.println(list);
    }

    class Student{
        private String name;
        private int age;
        public Student() {
        }

        public Student(String name, int age) {
            this.name = name;
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }

        @Override
        public String toString() {
            return "Student{" +
                    "name='" + name + '\'' +
                    ", age=" + age +
                    '}';
        }
    }
    @Test
    public void a11_4() {
        ArrayList<Student> students = new ArrayList<>();
        System.out.println(System.getProperty("file.encoding"));

        students.add(new Student("张三", 14));
        students.add(new Student("李四", 19));
        System.out.println(students);
    }
}










